/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Beans;

import Entities.TblCurriculum;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author CuongNV
 */
@ManagedBean
@RequestScoped
public class CurriculumManagedBean extends TblCurriculum {

    private static TblCurriculum curriculumBean;

    /** Creates a new instance of CurriculumManagedBean */
    public CurriculumManagedBean() {
    }
    private List<TblCurriculum> all;

    public List<TblCurriculum> getAll() {
        try {
            all = new BLL.CurriculumBLL().getAll();
            return all;
        } catch (Exception ex) {
            Logger.getLogger(CurriculumManagedBean.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    public String add() {
        try {
            new BLL.CurriculumBLL().add(this.curriculumBean);
            return "curriculumlist";
        } catch (Exception ex) {
            Logger.getLogger(CurriculumManagedBean.class.getName()).log(Level.SEVERE, null, ex);
            return "null";
        }

    }

    public String update() {
        if (new BLL.CurriculumBLL().update(this.curriculumBean)) {
            return "curriculumlist";
        } else {
            return "null";
        }
    }

    public String delete() {
        if (new BLL.CurriculumBLL().delete(this.curriculumBean)) {
            return "curriculumlist";
        } else {
            return "null";
        }
    }

    public TblCurriculum getCurriculumBean() {
        return curriculumBean;
    }

    public void setCurriculumBean(TblCurriculum curriculumBean) {
        this.curriculumBean = curriculumBean;
    }
}
